package pro.cherish.knowledgeumldesignpattern.designPattern.com.cherish.flyweight;

/**
 * 享元类
 */
public interface CherssFlyWeight {
    void setColor(String color);
    String getColor();
    void display(Coordinate c);
}
//共享享元类 内部状态
class ConcreteChess implements CherssFlyWeight{

    private String color;

    public ConcreteChess(String color) {
        super();
        this.color = color;
    }

    @Override
    public void setColor(String color) {
        this.color=color;
    }

    @Override
    public String getColor() {
        return color;
    }

    @Override
    public void display(Coordinate c) {
        System.out.println("棋子color "+color);
        System.out.println("site "+c.getX()+ " "+c.getY());
    }
}
